package com.example.webservice.client;

import com.example.webservice.provider.service.User;
import com.example.webservice.provider.service.UserManager;
import com.example.webservice.provider.service.UserService;

public class WebServiceClient {

    public static void main(String[] args) {
        WebServiceClient webServiceClient = new WebServiceClient();
        System.out.println("webServiceClient.get ---> " + webServiceClient.get(1));
        User user = new User();
        user.setName("webService");
        user.setAge(15);
        System.out.println("webServiceClient.add ---> " + webServiceClient.add(user));
    }

    public User add(User user) {
        return userService().addUser(user);
    }

    public User get(Integer id) {
        return userService().getUser(id);
    }

    private UserService userService() {
        UserManager manager = new UserManager();
        return manager.getUserServicePort();
    }
}
